package zozopo.manual;

import java.sql.Connection;
import java.util.List;

import zozopo.database.BusiDatabaseManager;
import zozopo.manual.operations.ReleaseOS;
import zozopo.manual.operations.ReleaseTB;
import zozopo.operations.comm.DictionaryOS;

import com.opensymphony.xwork2.ActionSupport;

public class AreaAction extends ActionSupport{
	//传入参数
	private String kind;
	//分页参数
	private int beginPageNum = 0;
	private int pageSize = 20;
	private int rowNum = 0;
	//传出参数
	List<ReleaseTB> releaseList;
	private String area;
	
	
	


	public String execute(){
		BusiDatabaseManager databaseConnection = new BusiDatabaseManager();
		Connection conn = databaseConnection.getConnection();
		ReleaseOS releaseOS = new ReleaseOS(conn);
		DictionaryOS dictionaryOS = new DictionaryOS(conn);
		
		area = dictionaryOS.getDictValue(kind);
		
		rowNum = releaseOS.getRowNumByKind(kind);
		
		releaseList = releaseOS.selectByKindForArea(kind, beginPageNum, pageSize);
		if(releaseList == null){
			return ERROR;
		}
		
		databaseConnection.releaseConnection(conn);
		return SUCCESS;
	}
	
	
	public String getKind() {
		return kind;
	}

	public void setKind(String kind) {
		this.kind = kind;
	}

	public int getBeginPageNum() {
		return beginPageNum;
	}

	public void setBeginPageNum(int beginPageNum) {
		this.beginPageNum = beginPageNum;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getRowNum() {
		return rowNum;
	}

	public void setRowNum(int rowNum) {
		this.rowNum = rowNum;
	}

	public List<ReleaseTB> getReleaseList() {
		return releaseList;
	}

	public void setReleaseList(List<ReleaseTB> releaseList) {
		this.releaseList = releaseList;
	}
	
	public String getArea() {
		return area;
	}


	public void setArea(String area) {
		this.area = area;
	}
}
